﻿using System;
using System.ComponentModel;
using System.Runtime.InteropServices;

namespace Teigha.Core
{
	public class OdGiExtAccum : OdGiConveyorNode
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public OdGiExtAccum(IntPtr cPtr, bool cMemoryOwn) : base(GlobalsPINVOKE.OdGiExtAccum_SWIGUpcast(cPtr), cMemoryOwn)
		{
			this.swigCPtr = new HandleRef(this, cPtr);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static HandleRef getCPtr(OdGiExtAccum obj)
		{
			if (obj != null)
			{
				return obj.swigCPtr;
			}
			return new HandleRef(null, IntPtr.Zero);
		}

		~OdGiExtAccum()
		{
			this.Dispose();
		}

		public override void Dispose()
		{
			if (this.swigCPtr.Handle != IntPtr.Zero)
			{
				if (this.swigCMemOwn)
				{
					lock (this.locker)
					{
						if (this.swigCPtr.Handle != IntPtr.Zero && this.swigCMemOwn)
						{
							this.swigCMemOwn = false;
							GlobalsPINVOKE.delete_OdGiExtAccum(this.swigCPtr);
						}
					}
					this.swigCMemOwn = false;
				}
				this.swigCPtr = new HandleRef(null, IntPtr.Zero);
			}
			GC.SuppressFinalize(this);
			base.Dispose();
		}

		public new static OdGiExtAccum cast(OdRxObject pObj)
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = GlobalsPINVOKE.OdGiExtAccum_cast(OdRxObject.getCPtr(pObj));
			OdGiExtAccum result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdGiExtAccum)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdGiExtAccum)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdGiExtAccum)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new static OdRxClass desc()
		{
			OdRxClass result = (OdRxClass)Teigha.Core.Helpers.odrxCreateObjectInternal(GlobalsPINVOKE.OdGiExtAccum_desc(), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdRxClass isA()
		{
			OdRxClass result = (OdRxClass)Teigha.Core.Helpers.odrxCreateObjectInternal(GlobalsPINVOKE.OdGiExtAccum_isA(this.swigCPtr), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdRxObject queryX(OdRxClass protocolClass)
		{
			OdRxObject result = Teigha.Core.Helpers.odrxCreateObjectInternal(GlobalsPINVOKE.OdGiExtAccum_queryX(this.swigCPtr, OdRxClass.getCPtr(protocolClass)), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new static OdGiExtAccum createObject()
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = GlobalsPINVOKE.OdGiExtAccum_createObject();
			OdGiExtAccum result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdGiExtAccum)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdGiExtAccum)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdGiExtAccum)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual void setDrawContext(OdGiConveyorContext pDrawContext)
		{
			GlobalsPINVOKE.OdGiExtAccum_setDrawContext(this.swigCPtr, pDrawContext.GetCPtr());
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void setDeviation(OdGeDoubleArray deviations)
		{
			GlobalsPINVOKE.OdGiExtAccum_setDeviation__SWIG_0(this.swigCPtr, OdGeDoubleArray.getCPtr(deviations));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void setDeviation(OdGiDeviation pDeviation)
		{
			GlobalsPINVOKE.OdGiExtAccum_setDeviation__SWIG_1(this.swigCPtr, pDeviation.GetCPtr());
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual OdGiConveyorGeometry geometry()
		{
			OdGiConveyorGeometry_Internal result = new OdGiConveyorGeometry_Internal(GlobalsPINVOKE.OdGiExtAccum_geometry(this.swigCPtr), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual bool getExtents(OdGeExtents3d extents)
		{
			bool result = GlobalsPINVOKE.OdGiExtAccum_getExtents(this.swigCPtr, OdGeExtents3d.getCPtr(extents));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual void resetExtents(OdGeExtents3d newExtents)
		{
			GlobalsPINVOKE.OdGiExtAccum_resetExtents__SWIG_0(this.swigCPtr, OdGeExtents3d.getCPtr(newExtents));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void resetExtents()
		{
			GlobalsPINVOKE.OdGiExtAccum_resetExtents__SWIG_1(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void addExtents(OdGeExtents3d extents)
		{
			GlobalsPINVOKE.OdGiExtAccum_addExtents(this.swigCPtr, OdGeExtents3d.getCPtr(extents));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public static void textExtents(OdGiConveyorContext pDrawContext, OdGiTextStyle textStyle, string pStr, int nLength, uint raw, OdGePoint3d minExt, OdGePoint3d maxExt, OdGePoint3d pEndPos, OdGeExtents3d pExactExtents)
		{
			GlobalsPINVOKE.OdGiExtAccum_textExtents__SWIG_0(pDrawContext.GetCPtr(), OdGiTextStyle.getCPtr(textStyle), pStr, nLength, raw, OdGePoint3d.getCPtr(minExt), OdGePoint3d.getCPtr(maxExt), OdGePoint3d.getCPtr(pEndPos), OdGeExtents3d.getCPtr(pExactExtents));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public static void textExtents(OdGiConveyorContext pDrawContext, OdGiTextStyle textStyle, string pStr, int nLength, uint raw, OdGePoint3d minExt, OdGePoint3d maxExt, OdGePoint3d pEndPos)
		{
			GlobalsPINVOKE.OdGiExtAccum_textExtents__SWIG_1(pDrawContext.GetCPtr(), OdGiTextStyle.getCPtr(textStyle), pStr, nLength, raw, OdGePoint3d.getCPtr(minExt), OdGePoint3d.getCPtr(maxExt), OdGePoint3d.getCPtr(pEndPos));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public static void textExtents(OdGiConveyorContext pDrawContext, OdGiTextStyle textStyle, string pStr, int nLength, uint raw, OdGePoint3d minExt, OdGePoint3d maxExt)
		{
			GlobalsPINVOKE.OdGiExtAccum_textExtents__SWIG_2(pDrawContext.GetCPtr(), OdGiTextStyle.getCPtr(textStyle), pStr, nLength, raw, OdGePoint3d.getCPtr(minExt), OdGePoint3d.getCPtr(maxExt));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		private object locker = new object();

		private HandleRef swigCPtr;
	}
}
